package com.test.sshshiro.util;

import org.apache.shiro.SecurityUtils;

import com.test.sshshiro.framework.vo.ShiroUser;

public class ShiroSecurityUtil {

	public static Long getLoginId() {
		try {
			if (SecurityUtils.getSubject() != null && SecurityUtils.getSubject().getPrincipal() != null) {
				
				return ((ShiroUser) SecurityUtils.getSubject().getPrincipals().getPrimaryPrincipal()).getId();
			}
		} catch (Exception e) {
			//e.printStackTrace();
			return Long.valueOf(1);
		}
		return Long.valueOf(1);
	}
}
